package com.googlecode.cardamomo.jaxb;

import com.googlecode.cardamomo.ermodel.DataType;
import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;

public class NSPrefixMapper extends NamespacePrefixMapper {

    private static final String ERM_PREFIX = ""; // DEFAULT NAMESPACE
    private static final String ERM_URI = DataType.CARDAMOMO_NAMESPACE;
 
    private static final String XSI_PREFIX = "xsi";
    private static final String XSI_URI = "http://www.w3.org/2001/XMLSchema-instance";
 
    @Override
    public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
        if(ERM_URI.equals(namespaceUri)) {
            return ERM_PREFIX;
        } else if(XSI_URI.equals(namespaceUri)) {
            return XSI_PREFIX;
        }
        return suggestion;
    }
 
    @Override
    public String[] getPreDeclaredNamespaceUris() {
        return new String[] { ERM_URI, XSI_URI };
    }
    

}
